import App from './App'
import message from './common/message.js'
import store from './store/index.js'
// #ifndef VUE3
import Vue from 'vue'
import uView from "./uview-ui";
Vue.prototype.$toast = message
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$checkPermission = (permission)=>{
	let data = uni.getStorageSync('roles')
	if(data){
		let arr = [];
		if(Array.isArray(permission)){
			permission.forEach(t=>{
				let tArr = data.filter(item=>item==t);
				arr=arr.concat(tArr);
			})
		}else{
			 arr = data.filter(item=>item==permission);
		}
		return arr&&arr.length>0;
	}else{
		console.error("用户未登录")
	}
	return false;
}
Vue.use(uView);
App.mpType = 'app'
const app = new Vue({
	store,
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif